import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'routers/main/main_routes.dart';
import 'routers/app_pages.dart';
import 'core/global_service/index.dart';
import 'application.dart';

void main() async {
  await Application.init();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    /// 屏幕适配
    return ScreenUtilInit(
      splitScreenMode: true,
      minTextAdapt: true,
      // 适配尺寸，设计稿尺寸
      designSize: const Size(375, 812),
      builder: (context, child) {
        return GetMaterialApp(
          // 页面切换动画
          defaultTransition: Transition.rightToLeft,
          // debug 模式下是否显示 Banner
          debugShowCheckedModeBanner: true,
          initialRoute: MainRoutes.main,
          initialBinding: GlobalBinding(),
          locale: const Locale('zh', 'CN'),
          builder: BotToastInit(),
          navigatorObservers: [BotToastNavigatorObserver()],
          getPages: AppPages.routes,
        );
      },
    );
  }
}
